#!/usr/bin/env python
'''
$Id: test_dcoracle2_dbapi20.py,v 1.2 2003/10/24 10:50:03 chrisw Exp $
'''

__rcs_id__  = '$Id: test_dcoracle2_dbapi20.py,v 1.2 2003/10/24 10:50:03 chrisw Exp $'
__version__ = '$Revision: 1.2 $'[11:-2]

import dbapi20
import unittest
import DCOracle2 as DB
import popen2

from common import getConnectionString

class test_DCOracle2(dbapi20.test_DBAPI20,unittest.TestCase):
    driver = DB
    connect_args = (getConnectionString(),)
    connect_kw_args = {}

    ddl1 = 'create table booze (name varchar2(64))'
    ddl2 = 'create table barflys (name varchar2(64))'

    samples = [        
        'Carlton Cold',
        'Carlton Draft',
        'Mountain Goat',
        'Redback',
        'Victoria Bitter',
        'XXXX'
    ]

    populate = [ddl1,] + \
        ["insert into booze values('%s')" % s for s in samples]

    def setUp(self):
        # Call superclass setUp In case this does something in the
        # future
        dbapi20.test_DBAPI20.setUp(self) 

        con = self._connect()
        con.close()

    def tearDown(self):
        dbapi20.test_DBAPI20.tearDown(self)

    def test_nextset(self):
        # Assuming DB doesn't implement this
        pass

    def test_callproc(self):
        return

        con = DB.connect(**self.connect_kw_args)
        try:
            cur = con.cursor()
            args = ("FOO",)
            r = cur.callproc('lower',args)
            self.assertEqual(r,args)
            r = cur.fetchall()
            self.assertEqual(r[0][0],'foo')
        finally:
            con.close()

    def test_setoutputsize(self):
        # Does DB implement this?
        pass

if __name__ == '__main__':
    unittest.main()
